#include <unistd.h>
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int value = 200;
    printf("主进程(%d)开始执行\n", getpid());
    int subprocess = fork();
    if(subprocess == -1)
    {
        printf("子进程创建失败\n");
        return -1;
    }
    if(subprocess == 0)
    {
        value--;
        printf("子进程(%d)开始执行,value(%p)=%d\n", getpid(), &value, value);
    }
    else
    {
        value++;
        printf("子进程创建成功,value(%p)=%d\n", &value, value);
    }
    printf("进程(%d)执行完毕\n",getpid());
    return 0;
}
